package top.infopub.mgr.sys.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import top.infopub.mgr.common.vo.RspVo;
import top.infopub.generic.GenericController;
import top.infopub.mgr.common.page.ParamPage;
import top.infopub.model.sys.ErrorLog;
import top.infopub.tdp.sys.service.ErrorLogService;
import top.infopub.tdp.sys.vo.SysErrorLogVo;

import com.github.pagehelper.Page;

/**
 * 后台-系统异常日志
 * @author dqs
 * */
@Controller
@RequestMapping("/errorLog")
public class SysErrorLogController extends GenericController {
	
	@Autowired
	private ErrorLogService errorLogService;

	/**
	 * 系统异常日志列表视图
	 * */
	@RequestMapping("/list")
	public String list() {
		return "sys/layerrorLog-list";
	}
	
	/**
	 * 根据条件查询系统异常日志
	 * */
	@RequestMapping("/queryDataByCondition")
	public @ResponseBody RspVo<ErrorLog> queryDataByCondition(SysErrorLogVo log, ParamPage page) {
		Page<ErrorLog> p = new Page<ErrorLog>(page.getPage(), page.getLimit());
		Page<ErrorLog> errorLogPage = errorLogService.selectErrorLogByCondition(p, log);
		return RspVo.getSuccessResponse(errorLogPage.getTotal(), errorLogPage.getResult());
	}
}
